package main

import (
	"fmt"
	"math/rand"
)

func multi() {
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			if (i == 3 && j == 3) || (j == 3 && i == 4) {
				fmt.Printf(" %d*%d=%d ", j, i, i*j)
			} else {
				fmt.Printf("%d*%d=%d ", j, i, i*j)
			}
		}
		fmt.Println()
	}
}

func randomSum() {
	var rander int = 0
	var sum int = 0
	var mul int = 1
	for i := 1; i <= 20; i++ {
		rander = rand.Intn(20) + 1
		if (i & 1) == 1 {
			sum += rander
		} else {
			mul *= rander

		}
	}
	fmt.Printf("sum=%d,mul=%d\n", sum, mul)
}

func printFab() {
	fabSlice := []int{1, 1}
	for i := 1; i < 100; i++ {
		if fabSlice[len(fabSlice)-1] < 100 {
			fabtmp := fabSlice[len(fabSlice)-1] + fabSlice[len(fabSlice)-2]
			if fabtmp < 100 {
				fabSlice = append(fabSlice, fabtmp)
			} else {
				break
			}
		}
	}
	fmt.Println(fabSlice)
}

func printFab1() {
	a, b := 1, 1
	for i := 1; i < 100; i++ {
		if b == 1 {
			fmt.Printf("%d %d", a, b)
		} else {
			fmt.Printf(" %d", b)
		}
		a, b = b, a+b
		if b > 100 {
			break
		}
	}

}
func main() {
	multi()
	randomSum()
	printFab()
	printFab1()
}

// 阿飞老师的批改
// 1. 代码逻辑清晰，适当写一些注释，方便自己以后查看
